Retry all non-200 API responses with exponential backoff#4
Merged
Conversation
Previously only 429 was retried. Transient errors like 500, 503, and 504 from the upstream stack are common (rate limits, timeouts, GCP auth blips) and worth retrying. Also wraps the infer endpoint with the retry decorator, which was missing.
emac-E
reviewed
Apr 6, 2026
For consistency keeping double quotes for keys like the other keys in this project. Removed debugging color that I put in as temporary.
emac-E
reviewed
Apr 6, 2026
like line 298, for consistency and rem temp color that I was watching in DEBUG output
emac-E
approved these changes
Apr 6, 2026
emac-E
left a comment
Owner
There was a problem hiding this comment.
This looks fine, I changed just a couple lines for consistency but thanks for adding this! I had made my changes before the LS-eval team added retry, so skipped updating that and luckily have not had a lot of errors so didn't notice the need! Thank you!
emac-E
added a commit
that referenced
this pull request
Apr 10, 2026
Retry all non-200 API responses with exponential backoff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inferendpoint with the retry decorator (was missing —queryandstreamingalready had it)_is_too_many_requests_error→_is_retryable_server_errorto reflect broader scopeMotivation
Transient errors from lightspeed-stack are common and varied:
Previously only 429 was retried, and the
inferendpoint had no retry at all. This caused false errors in evaluation runs — questions that would have passed on retry were reported as failures.Behavior
num_retries(default 3) with exponential backoff (4s, 4s, 8s)before_sleep_log